package cn.wolfcode.crm.web.controller;


import cn.wolfcode.crm.query.SaleItemChartQueryObject;
import cn.wolfcode.crm.service.ISmartAnalysisService;
import cn.wolfcode.crm.util.SaleItemChartJson;
import cn.wolfcode.crm.web.util.DailyChartJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("smartAnalysis")
public class SmartAnalysisController {

    @Autowired
    private ISmartAnalysisService service;


    @RequestMapping("")
    public String index() {
        //跳转分析主页面
        return "smartAnalysis/list";
    }

    @RequestMapping("saleItemChart")
    public String page2() {
        //跳转商品零售报表分析页面
        return "smartAnalysis/saleItemChart";
    }

    @RequestMapping("saleItemReturnChart")
    public String page3() {
        //跳转商品零售退货报表分析页面
        return "smartAnalysis/saleItemReturnChart";
    }

    @RequestMapping("daily")
    public String page4() {
        //日结账报表分析页面
        return "smartAnalysis/daily";
    }



    /**
     * 零售报表 (qo中状态为1,查询零售报表,状态为2查询退货报表)
     * @param qo
     * @return
     */
    @RequestMapping("saleItemChartJson")  //smartAnalysis/saleItemChartJson
    @ResponseBody
    public SaleItemChartJson saleItemChartJson(SaleItemChartQueryObject qo) {
        //生成零售报表所需数据,返回json
        return service.saleItemChart(qo);
    }
    /**
     * 日报表数据
     * @return
     */
    @RequestMapping("dailyChartJson")  //smartAnalysis/dailyChartJson
    @ResponseBody
    public DailyChartJson dailyChartJson() {
        //生成零售报表所需数据,返回json
        return service.dailyChart();
    }



}


